<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .search {
            width: 300px;
            height: 400px;
            margin: 100px auto;
        }

        input {
            width: 300px;
            height: 40px;
            outline: none;
            border: 1px solid grey;
        }

        .list {
            display: none;
            width: 100px;
            height: 40px;
        }

        .list li {
            width: 300px;
            height: 40px;
            border: 1px solid grey;
            list-style: none;
        }

        .color {
            border: 1px solid green;
            box-shadow: 0 2px 2px 0 red;
        }
    </style>
</head>

<body>
    <div class="search">
        <input type="text" placeholder="请输入要搜索的内容">
        <ul class="list">
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
            <li>5</li>
        </ul>
    </div>

    <script>
        const search = document.querySelector('input')
        const list = document.querySelector('.list')
        const li = document.querySelector('.list li')
        search.addEventListener('focus', function () {
            list.style.display = 'block'
            search.classList.add('color')
        })
        search.addEventListener('blur', function () {
            list.style.display = 'none'
            search.classList.remove('color')
        }) 
    </script>
</body>

</html>